#ifndef _MT5_GAMERULE_H_
#define _MT5_GAMERULE_H_

#include "mat_animation.h"
#include "mat_logicboard.h"



class MATTutorial;

class MATGameRule : public  MATAniFinishEventReceiveable
{
public:

	

	static MATGameRule&			Instance();
	

	virtual void				OnAnimationFinish(enum MATAnimation::ANI_TYPE AnimationType);

	void						NewGame();
	void						Start();
	void						NextTurn();	
	bool						IsTutorialActive()const;
	MATTutorial*				GetTutorial() { return m_pTutorial; };
	void						SetCountOfExcludeGemTypes(int Count);
	int							GetTotalTurns() const { return m_CurrentTurn; };
	
	void						SetBoardCountXY(int CountX, int CountY) { m_Count_X = CountX; m_Count_Y = CountY; };
	int							GetBoardCountX() const { return m_Count_X; };
	int							GetBoardCountY() const { return m_Count_Y; };
    
   
	MATGem* 					GetNewGemToSpawn();

	void						MouseButtonDown(const math::Vec2& Pos, int Y, int X);
	void						MouseButtonReleased(const math::Vec2& Pos, int Y, int X);
	void						Tick(float dt);

protected: 

	void						RandomSpawnGemTypes();
	

	int							m_ExclueGemCount;

	
private:

	MATGameRule();
	~MATGameRule();

	
	MATTutorial*				m_pTutorial;
	int							m_CurrentTurn;
	std::vector<int>			m_ExclueGemType;		

	int							m_Count_X;
	int							m_Count_Y;
	std::vector<MATGem*>		m_GemList;

};

#endif